

def get_download_time(file_size_mb,band_width_mbps):

    # 将文件大小转换Mb
    file_size_mbps = file_size_mb * 8

    #计算时间,文件大小 / 带宽大小
    time_seconds = file_size_mbps / band_width_mbps

    return time_seconds


file_size= 2 * 1024  #2GB = 2048MB的电影
band_width_mbps_list = [50,100,300,1000] # 30Mbps

for band_width_mbps in band_width_mbps_list:
    time_seconds = get_download_time(file_size,band_width_mbps)
    print(f"{file_size}MB的文件在{band_width_mbps / 8}MB的网速下的下载时间为{time_seconds}  秒")



